package com.ymatou.iapi.platformdiscounts.service;

import com.ymatou.iapi.platformdiscounts.parameter.DiscountInfo.ProductDiscountsInfo;
import com.ymatou.iapi.refund.parameter.CreateReturnBillResp;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;
/**
*计算商品优惠金额Call
*FreeMaker Template自动生成代码
*/
public class CalculateCall extends YmatouBaseCall{
	private static String opurl ="discount/calculate";
	
	public CalculateCall() {
		super(EnvSetup.getSystemUrl("platformdiscounts_iapi"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		//client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	 public String getErrorMsg()
	    {
	        return getString("errorMsg");
	    }
	 
	
	 public String getErrorCode()
	  {
	        return getString("errorCode");
	  }
	 
	
	public ProductDiscountsInfo getCallData()
	{
		ProductDiscountsInfo data = null;
		try {
			//data = (ProductDiscountsInfo) FormatUtil.GSONToObject(getString("productDiscounts"), ProductDiscountsInfo.class);
			data = (ProductDiscountsInfo) FormatUtil.GSONToObject(this.getReturnData(), ProductDiscountsInfo.class);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return data;
	}
}